package live.hotel.dao.impl;


import com.hotel.api.entity.SearchBookItemRS;
import com.hotel.api.services.SearchBookingItemService;

import live.hotel.entity.Order;

public class GetHotelOrder {
	
	public Order getHotelOrder(String orderId){
		Order order = null;
		try {
			SearchBookItemRS result = new SearchBookingItemService().searchBookItem(orderId);
			if(result!=null && result.getErrors()==null){
				order=new Order();
				order.setOrderId(orderId);
				order.setHotelName(result.getHotelName());
				order.setRoomType(result.getRoomName());
				order.setCreateTime(result.getCreationTime());
				order.setCancellTime(result.getCancellationTime());
				order.setCheckInDate(result.getCheckInDate());
				order.setCheckOutDate(result.getCheckOutDate());
				order.setNumberOfRooms(Integer.valueOf(result.getNumberOfRooms()));
				order.setArrivalTimeFrom(result.getArrivalTimeForm());
				order.setArrivalTimeTo(result.getArrivalTimTo());
				order.setPaxName(result.getCheckInfoPaxItems().getPaxName());
				order.setTotalBalsPrice(result.getTotalSalePrice());
				order.setTotalCommision(result.getCommission());
				order.setOrderStatus(result.getOrderStatus());
				order.setPayType(result.getPayment());
				order.setName(result.getContactPaxItem().getName());
				order.setMobile(result.getContactPaxItem().getMobile());
			}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return order;
	}
	
	
}
